<script context="module">
	export function preload({ params }) {
		const { slug } = params;

		return this.fetch(`blog/${slug}.json`).then(r => {
			return r.json().then(data => {
				if (r.status !== 200) {
					this.error(r.status, data);
				}

				return data;
			});
		});
	}
</script>

<script>
	export let post;
</script>

<h1>{post.title}</h1>